package mark.tom.sail;

import androidx.annotation.NonNull;

import static mark.tom.sail.Util.checkEmpty;

class DefaultFacade implements Facade {

    private static AnalyticsCollector collector;
    private static AnalyticsReporter reporter;

    DefaultFacade(@NonNull SailBuilder builder) {
        collector = builder.analyticsCollector();
        reporter = builder.analyticsReporter();
    }

    @Override
    public void collect(@NonNull String tag, @NonNull AnalyticsRecord record) throws Exception {
        checkEmpty(record.get());
        // 记录日志
        collector.collectLog(tag, record.get());
    }

    @Override
    public void report(@NonNull String... tags) throws Exception {
        // 上报日志
        reporter.reportLog(tags);
    }
}
